/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mekegi.whoanthro;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import com.mekegi.whoanthro.Sql.MeasureAdapter;

/**
 *
 * @author Arsen Abdusalamov <duburlan@gmail.com>
 */
public class MeasuresActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.measures);
        MeasureAdapter sqlAdapter = new MeasureAdapter(this);
        sqlAdapter.getAllEntries();
        String[] from = new String[] {
            Measure.KEY_HEIGHT, Measure.KEY_GIRTH_HEAD,
            Measure.KEY_HEIGHT, Measure.KEY_CREATED_AT
        };
        int[] to = new int[] {
            R.id.measure_item_height, R.id.measure_item_girth_head,
            R.id.measure_item_weight, R.id.measure_item_date
        };
        SimpleCursorAdapter listAdapter = new SimpleCursorAdapter(this, R.layout.measure_item,
            sqlAdapter.getAllEntries(), from, to);
        ((ListView)findViewById(R.id.measure_list)).setAdapter(listAdapter);
    }

    /**
     * @since 28.02.13 22:06
     */
    protected void todoMethod() {
        long result = 40404; //todo
        Intent resultIntent = new Intent();
        resultIntent.putExtra(MainActivity.KEY_FOR_RESULT_CHILD_ACTIVITY, result);
        setResult(Activity.RESULT_OK, resultIntent);
        finish();
    }
}
